package core;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import core.basic.Piece;


import agent.AgentHand;

class Hand implements AgentHand {
	private List<Piece> hand;
	
	public Hand () {
		this.hand = new ArrayList<Piece>();
	}
	public Piece getPiece(int i) {
		return hand.get(i);
	}
	public void putPiece(Piece p) {
		hand.add(p);
	}
	public void removePiece(Piece p) {
		hand.remove(p);
	}
	public int size() {
		return hand.size();
	}
	@Override
	public Iterator<Piece> iterator() {
		return hand.iterator();
	}
	public String toString() {
		String res = "";
		for (Piece p : hand) {
			res += p.toString();
		}
		return res;
	}
	public boolean HasPiece(Piece p) {
		return hand.contains(p);
	}
	public int sumPoints() {
		int res = 0;
		for (Piece p : hand) {
			res += p.getPoints();
		}
		return res;
	}
}
